package com.eqs.enterprisequestionnaire.controller;

import com.eqs.enterprisequestionnaire.result.R;
import com.eqs.enterprisequestionnaire.service.*;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/correlationAnalysis")
public class CorrelationAnalysisController {

    @Resource
    private CorrelationAnalysisService correlationAnalysisService;
    /*
    * 单选题与单选题的相关性分析
    * */
    @GetMapping("/correlationOqTOq/{questionId1}/{questionId2}/{methodId}")
    public R<Double> correlationOqTOq(@PathVariable Integer questionId1, @PathVariable Integer questionId2
            ,@PathVariable("methodId") String methodId){
        Double aDouble =correlationAnalysisService.correlationOqTOq(questionId1,questionId2,methodId);
        return R.success(aDouble);
    }
    /*
     * 单选题与选项(多选题、排序题、程度题)的相关性分析
     * */
    @GetMapping("/correlationOqTO/{questionId}/{optionId}/{methodId}")
    public R<Double> correlationOqTO(@PathVariable Integer questionId, @PathVariable Integer optionId
            ,@PathVariable("methodId") String methodId){
        Double aDouble =correlationAnalysisService.correlationOqTO(questionId,optionId,methodId);
        return R.success(aDouble);
    }
    /*
     * 选项和选项的相关性分析
     * */
    @GetMapping("/correlationOTO/{optionId1}/{optionId2}/{methodId}")
    public R<Double> correlationOTO(@PathVariable Integer optionId1, @PathVariable Integer optionId2
            ,@PathVariable("methodId") String methodId){
        Double aDouble =correlationAnalysisService.correlationOTO(optionId1,optionId2,methodId);
        return R.success(aDouble);
    }
}
